﻿#include <iostream>
#include <vector>
using namespace std;

class Solution
{
    const int INF = 0x3f3f3f3f;
public:
    // 322. 零钱兑换
    /*int coinChange(vector<int>& coins, int amount)
    {
        int n = coins.size();
        vector<vector<int>> dp(n + 1, vector<int>(amount + 1));

        for (int j = 1; j <= amount; j++)
            dp[0][j] = INF;

        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= amount; j++)
            {
                dp[i][j] = dp[i - 1][j];
                if (j >= coins[i - 1])
                    dp[i][j] = min(dp[i][j], dp[i][j - coins[i - 1]] + 1);
            }

        return dp[n][amount] >= INF ? -1 : dp[n][amount];
    }*/

    int coinChange(vector<int>& coins, int amount)
    {
        int n = coins.size();
        vector<int> dp(amount + 1);

        for (int j = 1; j <= amount; j++)
            dp[j] = INF;

        for (int i = 1; i <= n; i++)
            for (int j = 1; j <= amount; j++)
                if (j >= coins[i - 1])
                    dp[j] = min(dp[j], dp[j - coins[i - 1]] + 1);

        return dp[amount] >= INF ? -1 : dp[amount];
    }
};

int main()
{

    return 0;
}